<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/3/21
 * Time: 20:10
 */

namespace Home\Controller;


class MyController extends NavController
{

    public function __construct()
    {
        parent::__construct();
        $memberId = session('m_id');
        if (!$memberId){
            session('returnUrl',U('My/',ACTION_NAME));
            redirect(U('Member/login'));
        }
    }

    public function order()
    {
        $oderModel = D('Admin/Order');
        $data = $oderModel->search();
        // 设置页面信息
        $this->assign(array(
            'data' => $data,
            '_page_title' => '个人中心-我的定单',
        ));
        $this->display();
    }

    public function order_detail(){
        $orderId = I('get.order_id', 0);
        $orderModel = D('Admin/Order');
        $orderData = $orderModel->getDetail($orderId);

        // 设置页面中的信息
        $this->assign( array(
            'order' => $orderData,
            '_page_title' => '个人中心-订单详情',
        ) );
        $this->display();
    }
}